package
{
	import State.*;
	
	import flash.display.Sprite;
	import flash.events.Event;
	public class CGame extends Game
	{		
		
		private static var m_pGame:CGame = null;
		public var m_keypad:Keypad = new Keypad();
		public var m_touchInterfMgr:CTouchInterfaceManager = new CTouchInterfaceManager();
		
		public var m_playerName:String;
		public var m_sessionKey:String;
		public var m_bIsConnecting:Boolean;
		
		public function AuthenticateKey():String
		{
			return "&username=" + m_playerName + "&sessionkey=" + m_sessionKey;
		}
		public static function GetGame():CGame
		{			
			return m_pGame;
		}
		
		public function CGame(width:int, height:int, main:Sprite)
		{
			super(width, height, main);
			m_pGame = this;
			Init();
		}
		
		public function Init():void
		{
			//m_touchInterfMgr = new CTouchInterfaceManager();	
			m_bIsConnecting = false;
		}
		
		public static function CreateState(i:int):State
		{
			switch(i)
			{
				case 1:
					return new GSLogin();
					break;
				case 2:
					return new GSColosseum();
					break;
				case 3:
					return new GSBattle();
					break;
				
			}
			return null;
		}
		
		protected override function Render(event:Event):void
		{			
			Game.GetMyGraphics().Clear(0xffffff);
			super.Render(event);
			m_keypad.Update();
			m_touchInterfMgr.Update();			
			m_keypad.Draw();
			m_touchInterfMgr.Render();
		}
	}
}